package com.yycwxt.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;


@Data
@TableName("glb_store")
public class Store {

    // 编译器会默认添加一个无参数构造
    // int为基本类型，默认值为0 ； 而Integer为引用类型，默认值为null
    @TableId(type = IdType.AUTO) // mybatis-plus  遵循自增长原则
    @PositiveOrZero(message = "必须为正整数")
    private Integer id;

    @NotBlank(message = "长度不能为0")
    @NotNull(message = "不能为空")
    @Size(max = 15, message = "长度不能超过15")
    @ExcelProperty("编码")
    private String code;

    @NotBlank(message = "长度不能为0")
    @NotNull(message = "不能为空")
    @Size(max = 8, message = "长度不能超过8")
    @ExcelProperty("拼音")
    private String pinyin;

    @NotBlank(message = "长度不能为0")
    @NotNull(message = "不能为空")
    @Size(max = 31, message = "长度不能超过31")
    @ExcelProperty("名称")
    private String name;

    @Size(max = 63, message = "长度不能超过63")
    @ExcelProperty("全名")
    private String fullname;

    @NotBlank(message = "长度不能为0")
    @NotNull(message = "不能为空")
    @Size(max = 7, message = "长度不能超过7")
    @ExcelProperty("城市")
    private String city;

    @Size(max = 63, message = "长度不能超过63")
    @ExcelProperty("地址")
    private String address;

    @Size(max = 63, message = "长度不能超过63")
    @ExcelProperty("备注")
    private String remark;

    @TableField(insertStrategy = FieldStrategy.NEVER)
    private LocalDateTime created;

}
